#pragma once

#pragma unmanaged

#include <BWSAL\TaskExecutor.h>

#pragma managed

#include "..\AiBase.h"
#include "Interfaces\ITaskExecutor.h"
#include "Interfaces\IUnitArbitrator.h"
#include "Interfaces\IBuildEventTimeline.h"
#include "Interfaces\IReservedMap.h"
#include "Interfaces\IBuildingPlacer.h"

using namespace BroodWar;

namespace BroodWar
{
	namespace Addon
	{
		public ref class TaskExecutor : public AiBase, ITaskExecutor
		{
		internal:
			BWSAL::TaskExecutor* instance;

			TaskExecutor(BWSAL::TaskExecutor* executor);
			~TaskExecutor();
			!TaskExecutor();

			static TaskExecutor^ s_instance;
		public:
			static void Create(IUnitArbitrator^ arbitrator, IBuildEventTimeline^ timeline, IReservedMap^ reserveMap, IBuildingPlacer^ defaultBuildingPlacer);
			static property TaskExecutor^ Instance { TaskExecutor^ get(); }

			virtual void OnOffer(IEnumerable<Unit^>^ units);
			virtual void OnRevoke(Unit^ unit, double bid);
			virtual property String^ Name { String^ get(); }
			virtual void OnFrame() override;
			virtual void Run(Task^ t);
			virtual int GetRunningCount(BuildType type);
		};
	}
}
